package com.yizhu.zczy.system.controller;

import java.util.Arrays;
import java.util.Map;


import com.yizhu.zczy.common.utils.PageUtils;
import com.yizhu.zczy.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.yizhu.zczy.system.entity.LinksEntity;
import com.yizhu.zczy.system.service.LinksService;




/**
 * 友情链接表
 *
 * @author guoyz
 * @email guoyz@mail.com
 * @date 2021-06-24 18:29:34
 */
@RestController
@RequestMapping("system/links")
public class LinksController {
    @Autowired
    private LinksService linksService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("system:links:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = linksService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{linksId}")
    //@RequiresPermissions("system:links:info")
    public R info(@PathVariable("linksId") Integer linksId){
		LinksEntity links = linksService.getById(linksId);

        return R.ok().put("links", links);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("system:links:save")
    public R save(@RequestBody LinksEntity links){
		linksService.save(links);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("system:links:update")
    public R update(@RequestBody LinksEntity links){
		linksService.updateById(links);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("system:links:delete")
    public R delete(@RequestBody Integer[] linksIds){
		linksService.removeByIds(Arrays.asList(linksIds));

        return R.ok();
    }

}
